{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f8389fbb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "import os\n",
    "sys.path.append(os.path.abspath('..'))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "11a9217b",
   "metadata": {},
   "source": [
    "# Comparação entre Modelos\n",
    "Comparando desempenho de 4 arquiteturas de CNNs em CIFAR-10."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1a9a2a1",
   "metadata": {},
   "source": [
    "# Estrutura de Resultados"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8b6a3268",
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "resultados = {\n",
    "    \"Modelo Base\": {\n",
    "        \"acc_treino\": [0.42, 0.58, 0.65, 0.69, 0.72],\n",
    "        \"acc_teste\": [0.40, 0.55, 0.61, 0.65, 0.68],\n",
    "        \"loss_treino\": [1.8, 1.4, 1.1, 0.9, 0.8],\n",
    "        \"loss_teste\": [1.9, 1.5, 1.2, 1.0, 0.9]\n",
    "    },\n",
    "    \"n_features\": {\n",
    "        \"acc_treino\": [0.47, 0.62, 0.71, 0.75, 0.78],\n",
    "        \"acc_teste\": [0.45, 0.60, 0.67, 0.70, 0.72],\n",
    "        \"loss_treino\": [1.6, 1.2, 0.9, 0.7, 0.6],\n",
    "        \"loss_teste\": [1.7, 1.3, 1.0, 0.8, 0.7]\n",
    "    },\n",
    "    \"blocos\": {\n",
    "        \"acc_treino\": [0.50, 0.66, 0.74, 0.78, 0.80],\n",
    "        \"acc_teste\": [0.48, 0.63, 0.70, 0.73, 0.75],\n",
    "        \"loss_treino\": [1.5, 1.1, 0.8, 0.6, 0.5],\n",
    "        \"loss_teste\": [1.6, 1.2, 0.9, 0.7, 0.6]\n",
    "    },\n",
    "    \"seu_modelo\": {\n",
    "        \"acc_treino\": [0.52, 0.68, 0.77, 0.81, 0.84],\n",
    "        \"acc_teste\": [0.50, 0.65, 0.72, 0.76, 0.78],\n",
    "        \"loss_treino\": [1.4, 1.0, 0.7, 0.5, 0.4],\n",
    "        \"loss_teste\": [1.5, 1.1, 0.8, 0.6, 0.5]\n",
    "    }\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df3ad5cf",
   "metadata": {},
   "source": [
    "# Gráficos Comparativos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eae5c7bd",
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "def plot_comparacoes(resultados, tipo=\"acc_teste\"):\n",
    "    plt.figure(figsize=(10, 6))\n",
    "    for nome_modelo, dados in resultados.items():\n",
    "        plt.plot(dados[tipo], label=nome_modelo)\n",
    "    plt.title(f\"Comparação de {'Acurácia' if 'acc' in tipo else 'Loss'} - {tipo}\")\n",
    "    plt.xlabel(\"Épocas\")\n",
    "    plt.ylabel(\"Valor\")\n",
    "    plt.legend()\n",
    "    plt.grid(True)\n",
    "    plt.show()\n",
    "\n",
    "plot_comparacoes(resultados, \"acc_teste\")\n",
    "plot_comparacoes(resultados, \"loss_teste\")"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
